<template>
  <div>
    <ul>
      <li><router-link to="/allcontacts">All_contacts</router-link></li>
      <li><router-link to="/alice">Alice</router-link></li>
      <li>
        <router-link to="/about">Bob</router-link>
      </li>
    </ul>
    <button @click="fn()">随机显示</button>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "MySport",
  components: {},
  props: {},
  data() {
    return {
        flag:''
    };
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    fn() {
        this.flag = (Math.floor(Math.random() * (4 - 0 + 1) + 0))
        if (this.flag ===1) {
            this.$router.push('/allcontacts');
        }else if(this.flag ===2) {
            this.$router.push('/alice');
        }else {
            this.$router.push('/about');
        } 
    },
  },
};
</script>

<style scoped></style>
